/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package under.wsl.request;

import java.util.ArrayList;
import java.util.List;

/**
 * @author alex.query
 */
public class RequestService {
    private int idRequest = 0;
    private int tk = 0;
    private int t = 0;
    private boolean cache=false;
    private String tipo="void";
    private String s = "";
	private String format = "json";
	private String callback = "callback";
    private Object rs = null;
    List<String> erro = new ArrayList<String>();   
    public RequestService(){
        
    }
    public void clearResult(){
        //this.result.setLength(0);
    }
    public List<String> getErro() {
            return this.erro;
    }
    public void addErro(String errop) {
            //System.out.println("erro do rq --> "+errop);
            this.erro.add(errop);
    }
    public void clearErro(){
            this.erro.clear();
    }
    public boolean isCache() {
        return cache;
    }
    public int getIdRequest() {
        return idRequest;
    }

    public int getT() {
        return t;
    }
    public String getTipo() {
        return tipo;
    }
    public int getTk() {
        return tk;
    }
    public String getS() {
        return s;
    }
    public void setCache(boolean cache) {
        this.cache = cache;
    }
    public boolean getCache() {
        return this.cache;
    }
    public void setErro(List<String> erros) {
        this.erro = erros;
    }
    public void setIdRequest(int idRequest) {
        this.idRequest = idRequest;
    }

    public void setS(String s) {
        this.s = s;
    }
    public void setT(int t) {
        this.t = t;
    }
    public void setTipo(String tipo) {
        this.tipo = tipo.toLowerCase();
    }
    public void setTk(int tk) {
        this.tk = tk;
    }
    public String getMetodo(){        
        return  this.getS().substring(this.getS().lastIndexOf('.') + 1,this.getS().length());
    }
    public String getServico(){    
    	String[] termos =  this.getS().split("\\.");
    	if(termos.length>2){
    		return termos[termos.length-2];
    	}
        //return this.getS().substring(0, this.getS().indexOf('.'));
        return termos[0];
    }
    public String getModule(){    
    	if(this.getS().lastIndexOf('.') > -1){
    		return this.getS().substring(0,this.getS().lastIndexOf('.'));
    	}
    	return this.getS();    	
    }
	public String getFormat(){        
        return  this.format;
    }
	public void setFormat(String format){        
        this.format = format;
    }
	public String getCallback() {
		return this.callback;
	}
	public void setCallback(String callback) {
		this.callback = callback;
	}
    public void setRs(Object rs){
        this.rs = rs;
    }
    public Object getRs(){  
        return this.rs;
    }
}
